home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 44 / PC Actual CD 44.iso / Linux / Cygwin / full.exe / Disk1 / data1.cab / Tools / share / tix4.1 / pref / tixmkpref < prev    next >
Encoding:
Text File  |  1998-12-04  |  10.4 KB  |  414 lines

  1. #!/usr/local/bin/tclsh
  2. # Undocumented program. Don't use it.
  3. #
  4. # Usage:
  5. #     tixmkpref option name.src > name.tcl
  6. #
  7.  
  8. proc tixDefOption {classes specs {level \$tixOption(prioLevel)}} {
  9.     global isFont tixOption
  10.  
  11.     foreach class $classes {
  12.     foreach spec $specs {
  13.         if [regexp (Font)|(font) $spec] {
  14.         if {$isFont} {
  15.             puts "option add *$class$spec $level"
  16.         }
  17.         } else {
  18.         if {!$isFont} {
  19.             set aspec [subst $spec]
  20.             puts "option add *$class$spec $level"
  21.         }
  22.         }
  23.     }
  24.     }
  25. }
  26.  
  27. proc option {classes specs {level \$tixOption(prioLevel)}} {
  28.     tixDefOption $classes $specs $level
  29. }
  30.  
  31. proc tixInitOptionDatabase {isWin} {
  32.     global tixOption isFont
  33.  
  34.     # general stuff, everything gets these defaults unless otherwise specified
  35.     #-------------------------------------------------------------------------
  36.     if {! $isWin} then {
  37.     tixDefOption {""} {{Font            $tixOption(font)}}
  38.     tixDefOption {""} {{font            $tixOption(font)}}
  39.  
  40.     tixDefOption {""} {{background         $tixOption(bg)}}    10
  41.     tixDefOption {""} {{Background        $tixOption(bg)}}
  42.     tixDefOption {""} {{background        $tixOption(bg)}}
  43.     tixDefOption {""} {{Foreground        $tixOption(fg)}}
  44.     tixDefOption {""} {{foreground        $tixOption(fg)}}
  45.     tixDefOption {""} {{activeBackground    $tixOption(active_bg)}}
  46.     tixDefOption {""} {{activeForeground    $tixOption(active_fg)}}
  47.     tixDefOption {""} {{HighlightBackground    $tixOption(bg)}}
  48.     tixDefOption {""} {{selectBackground    $tixOption(select_bg)}}
  49.     tixDefOption {""} {{selectForeground    $tixOption(select_fg)}}
  50.     tixDefOption {""} {{selectBorderWidth    0}}
  51.     }
  52.  
  53.     #----------------------------------------
  54.     # Standard TK Widget Options
  55.     #
  56.     # We set up the options for the TK widgets only if
  57.     # the strictTK option is not selected.
  58.     #----------------------------------------
  59.  
  60.     if {$isWin} then {
  61.     tixDefOption {Menu TixMenu} {
  62.         {.font            $tixOption(menu_font)}
  63.     }
  64.     } else {
  65.     tixDefOption {Menu TixMenu} {
  66.         {.font            $tixOption(menu_font)}
  67.         {.selectColor        $tixOption(selector)}
  68.     }
  69.     }
  70.  
  71.     tixDefOption {Menubutton} {
  72.     {.font            $tixOption(menu_font)}
  73.     {.padY            5}
  74.     }
  75.  
  76.     tixDefOption {Button} {
  77.     {.borderWidth        2}
  78.     {.anchor        c}
  79.     }
  80.  
  81.     if {! $isWin} then {
  82.     tixDefOption {Checkbutton Radiobutton} {
  83.         {.selectColor        $tixOption(selector)}
  84.     }
  85.     }
  86.  
  87.     tixDefOption {Entry} {
  88.     {.relief        sunken}
  89.     {.highlightBackground    $tixOption(bg)}
  90.     {.background        $tixOption(input1_bg)}
  91.     {.foreground        black}
  92.     {.insertBackground    black}
  93.     }
  94.  
  95.     tixDefOption {Label} {
  96.     {.anchor        w}
  97.     {.borderWidth        0}
  98.     {.font                  $tixOption(bold_font)}
  99.     }
  100.  
  101.     tixDefOption {Listbox} {
  102.     {.background        $tixOption(light1_bg)}
  103.     {.relief        sunken}
  104.     }
  105.  
  106.     tixDefOption {Scale} {
  107.     {.foreground        $tixOption(fg)}
  108.     {.activeForeground    $tixOption(bg)}
  109.     {.background        $tixOption(bg)}
  110.     {.sliderForeground    $tixOption(bg)}
  111.     {.sliderBackground    $tixOption(light1_bg)}
  112.     {.font            $tixOption(italic_font)}
  113.     }
  114.  
  115.     tixDefOption {Scrollbar} {
  116.     {.background        $tixOption(bg)}
  117.     {.troughColor        $tixOption(light1_bg)}
  118.     {.relief        sunken}
  119.     {.borderWidth        1}
  120.     {.width            15}
  121.     }
  122.  
  123.     tixDefOption {Text} {
  124.     {.background        $tixOption(input1_bg)}
  125.     {.relief        sunken}
  126.     }
  127.  
  128.     #----------------------------------------------------------------------
  129.     # TIX WIDGETS
  130.     #----------------------------------------------------------------------
  131.  
  132.     tixDefOption {TixBalloon} {
  133.     {*background             "#ffff60"}
  134.     {*foreground             black}
  135.     {.background             black}
  136.     {*Label.font             $tixOption(font)}
  137.     {*Label.anchor             w}
  138.     }
  139.  
  140.     tixDefOption {TixBitmapButton} {
  141.     {*label.font             $tixOption(font)}
  142.     }
  143.  
  144.     tixDefOption {TixControl} {
  145.     {*entry.highlightBackground    $tixOption(bg)}
  146.     {*entry.background        $tixOption(input1_bg)}
  147.     {*entry.foreground        black}
  148.     {*entry.insertBackground    black}
  149.     {*label.font                  $tixOption(bold_font)}
  150.     }
  151.  
  152.     # DLG_BTNS
  153.     #
  154.     tixDefOption {TixStdButtonBox} {
  155.     }
  156.  
  157.     # DIR_LIST
  158.     #
  159.     tixDefOption {TixDirTree TixDirList TixScrolledHList TixTree} {
  160.     {*Scrollbar.background        $tixOption(bg)}
  161.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  162.     {*hlist.highlightBackground    $tixOption(bg)}
  163.     {*hlist.background        $tixOption(input1_bg)}
  164.     {*hlist.activeBackground    $tixOption(input1_bg)}
  165.     {*hlist.disabledBackground    $tixOption(input1_bg)}
  166.     {*f1.borderWidth        1}
  167.     {*f1.relief            sunken}
  168.     }
  169.  
  170.     tixDefOption {TixFileEntry} {
  171.     {*Entry.background         $tixOption(input1_bg)}
  172.     }
  173.  
  174.     tixDefOption {TixHList} {
  175.     {.background            $tixOption(light1_bg)}
  176.     {.activeBackground        $tixOption(light1_bg)}
  177.     {.disabledBackground        $tixOption(light1_bg)}
  178.     }
  179.  
  180.     tixDefOption {TixLabelEntry} {
  181.     {*entry.highlightBackground    $tixOption(bg)}
  182.     {*entry.background        $tixOption(input1_bg)}
  183.     {*entry.foreground        black}
  184.     {*entry.insertBackground    black}
  185.     {*label.font                  $tixOption(bold_font)}
  186.     }
  187.  
  188.     tixDefOption {TixLabelFrame} {
  189.     {*label.font              $tixOption(bold_font)}
  190.     }
  191.  
  192.     tixDefOption {TixMultiList} {
  193.     {*Listbox.borderWidth        0}
  194.     {*Listbox.highlightThickness    0}
  195.     {*Scrollbar.background        $tixOption(bg)}
  196.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  197.     {*Scrollbar.relief        sunken}
  198.     {*Scrollbar.width        15}
  199.     {*f1.borderWidth        2}
  200.     {*f1.relief            sunken}
  201.     {*f1.highlightThickness        2}
  202.     }
  203.  
  204.     # MwmClient
  205.     #
  206.     tixDefOption {TixMwmClient} {
  207.     {*title.font            $tixOption(menu_font)}
  208.     }
  209.  
  210.     tixDefOption {TixMDIMenuBar} {
  211.     {*menubar.relief        raised}
  212.     {*menubar.borderWidth        2}
  213.     {*Menubutton.padY         2}
  214.     }
  215.  
  216.     # NoteBook
  217.     #
  218.     tixDefOption {TixNoteBook} {
  219.     {.Background            $tixOption(bg)}
  220.     {.nbframe.Background        $tixOption(bg)}
  221.     {.nbframe.font            $tixOption(menu_font)}
  222.     {.nbframe.backPageColor        $tixOption(bg)}
  223.     {.nbframe.inactiveBackground    $tixOption(inactive_bg)}
  224.     }
  225.  
  226.     # OPTION_MENU
  227.     #
  228.     tixDefOption {TixOptionMenu} {
  229.     {*menubutton.font        $tixOption(font)}
  230.     }
  231.  
  232.     # PANED_WINDOW
  233.     #
  234.     tixDefOption {TixPanedWindow} {
  235.     {.handleActiveBg         $tixOption(active_bg)}
  236.     {.separatorBg            $tixOption(bg)}
  237.     {.handleBg               $tixOption(bg)}
  238.     }
  239.  
  240.     # POPUP MENU
  241.     #
  242.     tixDefOption {TixPopupMenu} {
  243.     {*menubutton.background     $tixOption(dark1_bg)}
  244.     }
  245.  
  246.     # SCROLLED_HLIST
  247.     #
  248.     tixDefOption {TixScrolledHList} {
  249.     {*Scrollbar.background        $tixOption(bg)}
  250.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  251.     {*hlist.highlightBackground    $tixOption(bg)}
  252.     {*hlist.background        $tixOption(light1_bg)}
  253.     }
  254.  
  255.     tixDefOption {TixScrolledTList} {
  256.     {*Scrollbar.background        $tixOption(bg)}
  257.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  258.     {*tlist.highlightBackground    $tixOption(bg)}
  259.     {*tlist.background        $tixOption(light1_bg)}
  260.     }
  261.  
  262.     # SCROLLED_LISTBOX, .. ETC
  263.     #
  264.     tixDefOption {TixScrolledListBox} {
  265.         {.background            $tixOption(bg)}
  266.     {*Scrollbar.background        $tixOption(bg)}
  267.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  268.     {*listbox.highlightBackground    $tixOption(bg)}
  269.     {*listbox.background        $tixOption(light1_bg)}
  270.     }
  271.  
  272.     tixDefOption {TixScrolledText} {
  273.         {.background            $tixOption(bg)}
  274.     {*Scrollbar.background        $tixOption(bg)}
  275.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  276.     }
  277.  
  278.  
  279.     # SCROLLED_WINDOW
  280.     #
  281.     tixDefOption {TixScrolledWindow} {
  282.         {.background            $tixOption(bg)}
  283.     {*Scrollbar.background        $tixOption(bg)}
  284.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  285.     {.frame.background        $tixOption(light1_bg)}
  286.     }
  287.  
  288.  
  289.     # SELECT
  290.     #
  291.     tixDefOption {TixSelect} {
  292.     }
  293.  
  294.     tixDefOption {TixTree} {
  295.         {.background            $tixOption(bg)}
  296.     {*Scrollbar.background        $tixOption(bg)}
  297.     {*Scrollbar.troughColor        $tixOption(light1_bg)}
  298.     {*hlist.highlightBackground    $tixOption(bg)}
  299.     {*hlist.background        $tixOption(light1_bg)}
  300.     {*hlist.borderWidth        1}
  301.     }
  302.     # NON ALPHABETICAL ORDER WIDGETS
  303.  
  304.     # Since TK's option database follows the order-of-declaration rule, not
  305.     # specific-vs-general rule, the options of the widgets below depends on
  306.     # the options of the widget above, so their options must be defined here
  307.  
  308.     # COMBOBOX
  309.     if {! $isWin} then {
  310.     tixDefOption {TixComboBox} {
  311.         {*Entry.font                $tixOption(font)}
  312.         {*Entry.highlightBackground        $tixOption(bg)}
  313.         {*Entry.background            $tixOption(input1_bg)}
  314.         {*Entry.foreground            black}
  315.         {*Entry.insertBackground        black}
  316.     }
  317.     } else {
  318.     tixDefOption {TixComboBox} {
  319.         {*Entry.font                $tixOption(font)}
  320.         {*Entry.highlightBackground        $tixOption(input1_bg)}
  321.         {*Entry.background            $tixOption(input1_bg)}
  322.         {*Entry.foreground            SystemWindowText}
  323.         {*Entry.insertBackground        SystemWindowText}
  324.         {*Entry.selectBackground    $tixOption(select_bg)}
  325.         {*Entry.selectForeground    $tixOption(select_fg)}
  326.         {*TixScrolledListBox.selectBackground    $tixOption(select_bg)}
  327.         {*TixScrolledListBox.selectForeground    $tixOption(select_fg)}
  328.     }
  329.     }
  330.  
  331.     # FILE_SELECT_BOX
  332.     #
  333.     tixDefOption {TixFileSelectBox} {
  334.     {*Label.font                    $tixOption(bold_font)}
  335.     }
  336.  
  337.     tixDefOption {TixExFileSelectBox} {
  338.     }
  339. }
  340.  
  341. #----------------------------------------------------------------------
  342. # The default fontset and schemes
  343. #
  344. #----------------------------------------------------------------------
  345.  
  346. source ../DefSchm.tcl
  347. rename tixSetDefaultFontset         tixSetFontset
  348. rename tixSetDefaultScheme-Color     tixSetScheme-Color
  349. rename tixSetDefaultScheme-Mono     tixSetScheme-Mono
  350.  
  351. #----------------------------------------------------------------------
  352. # Action:
  353. #----------------------------------------------------------------------
  354. if [string match TK* [lindex $argv 1]] {
  355.     set isTK 1
  356. } elseif {[string match TkWin* [lindex $argv 1]]} {
  357.     set isTK 0
  358.     set isWin 1
  359. } else {
  360.     set isTK 0
  361.     set isWin 0
  362. }
  363. set schemeName [lindex [split [lindex $argv 1] "."] 0]
  364. source [lindex $argv 1]
  365.  
  366.  
  367. tixSetFontset
  368.  
  369. if {[lindex $argv 0] == "-font"} {
  370.  
  371.     set isFont 1
  372.  
  373.     # FontSets will be set in two steps.
  374.     # (1) init fontsets
  375.     #     ... tix checks the validity of the fonts ...
  376.     # (2) add the fontsets into the option database.
  377.     #
  378.     puts "proc tixPref:InitFontSet:$schemeName {} { "
  379.     puts [info body tixSetFontset]
  380.     puts "}"
  381.  
  382.     puts "proc tixPref:SetFontSet:$schemeName {} { "
  383.     puts "global tixOption"
  384.     if {! $isTK} {
  385.     tixInitOptionDatabase $isWin
  386.     }
  387.     puts "}"
  388.  
  389.  
  390. } else {
  391.     set isFont 0
  392.  
  393.     # Do the Color First
  394.     #
  395.     puts "proc tixPref:SetScheme-Color:$schemeName {} {"
  396.     puts [info body tixSetScheme-Color]
  397.     if {! $isTK} {
  398.     tixSetScheme-Color
  399.     tixInitOptionDatabase $isWin
  400.     }
  401.     puts "}"
  402.  
  403.     # Now Do the Mono
  404.     #
  405.     puts "proc tixPref:SetScheme-Mono:$schemeName {} {"
  406.     puts [info body tixSetScheme-Mono]
  407.     if {! $isTK} {
  408.     tixSetScheme-Mono
  409.     tixInitOptionDatabase $isWin
  410.     }
  411.     puts "}"
  412. }
  413.